package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"regexp"
	"strings"
)

func main() {
	pattern := ""
	if len(os.Args) > 1 {
		pattern = os.Args[1]
	}
	re, err := regexp.Compile(pattern)
	if err != nil {
		panic(err)
	}
	reader := bufio.NewReader(os.Stdin)
	for {
		data, err := reader.ReadBytes('\n')
		if err != nil && err == io.EOF {
			return
		}
		line := strings.Trim(string(data), "\n")

		found := re.MatchString(line)
		if found {
			fmt.Println(line)
		}
		// if strings.Contains(line, pattern) {
		// 	fmt.Println(line)
		// }
	}

}
